package com.dhy.takeaway.service;

import com.dhy.takeaway.dao.OrderDao;
import com.dhy.takeaway.entity.Order;
import com.dhy.takeaway.entity.OrderGood;
import com.dhy.takeaway.entity.StoreOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class OrderService {
    @Autowired
    OrderDao orderDao;

    public boolean addOrder(Order order){
        order.setCreateTime(new Date());
        return orderDao.addOrder(order) > 0;
    }
    public boolean addOrderGoods(List<OrderGood> orderGoods){
        return orderDao.addOrderGoods(orderGoods) > 0;
    }

    public List<Map> findOrderList(String buyerId){
        return orderDao.findOrderList(buyerId);
    }

    public List<Map> findOrderDetail(String orderId){
        return orderDao.findOrderDetail(orderId);
    }

    ///////////////////////////

    public List<StoreOrder> storeOrderList(String id){
        return orderDao.storeOrderList(id);
    }

    public List<Map> storeOrderDetail(String id){
        return orderDao.storeOrderDetail(id);
    }
}
